package com.fancy.imasclient.client;

import com.fancy.common.dto.response.Result;
import com.fancy.imasclient.dto.UserBasicInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

@FeignClient(name = "user-service", path = "/api/v1/users", contextId = "userServiceClient")
public interface UserServiceClient {

    @GetMapping("/{userId}")
    UserBasicInfo getUserBasicInfo(@PathVariable("userId") Long userId);

    @GetMapping("/exists/{userId}")
    Boolean existsById(@PathVariable("userId") Long userId);

    @PostMapping("/batch")
    Map<Long, UserBasicInfo> getUsersBasicInfoBatch(@RequestBody List<Long> userIds);

    /**
     * 获取用户基本信息（内部接口）
     */
    @GetMapping("/internal/{userId}")
    Result<UserBasicInfo> getUserBasicInfoInternal(@PathVariable("userId") Long userId);

    /**
     * 批量获取用户基本信息（内部接口）
     */
    @PostMapping("/internal/batch")
    Result<Map<Long, UserBasicInfo>> getUsersBasicInfoBatchInternal(@RequestBody List<Long> userIds);
}
